package com.situ.javase.week2.day4;

import java.util.ArrayList;

import org.junit.Test;

public class BaoZhuangLeiXingDemo {
	@Test
	public void test1() {
		ArrayList<Integer> list = new ArrayList<Integer>();
		list.add(2);
		list.add(12);
		for (Integer integer : list) {
			System.out.println(integer);
		}
		
		System.out.println(Integer.MAX_VALUE);
		System.out.println(Integer.MIN_VALUE);
		
		
		//自动拆箱和装箱
		//Integer integer = new Integer(4);
		Integer integer = new Integer(4);//自动装箱（等价于上面的操作）   
		int i = integer.intValue();
		int num = 4;
		num = num + 2;
		integer = integer + 2;  //自动拆箱 integer.intValue()
		//integer.intValue() + 2 = 6;
		 // 得到int类型的6有赋值给Integer类型，自动装箱
		   System.out.println(integer);
		}
		
		@Test
		public void test2() {
			String str = "20";
			int vaule1 = Integer.parseInt(str);
			System.out.println(vaule1);
			String str2 = "3.14";
			   double d = Double.parseDouble(str2);
			   System.out.println(d);
			   String str3 = "true";
			   boolean bool = Boolean.parseBoolean(str3);
			   System.out.println(bool);
			   // xxx value = XXX.parseXXX(String str)
			}
			
		}
